This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Feb 23, 2011, 8:17 PM
8 Posts

save data sources creating multiple documents

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 4
I have a Save button which executes the simple action xp:save. There are two data sources on my page. When executed on a new document, the action saves both data sources - twice! So instead of 2 documents, there are 4 created. In both situations, the first document created contains all expected fields, while the 2nd document contains two fields: $UpdatedBy, and Form.
I'm at a loss. The action properties for the save button are
<xp:eventHandler event="onclick" submit="true"
                refreshMode="complete" immediate="false" save="true"
                disableValidators="true">
                <xp:this.action>
                    <xp:save name="$$PreviousPage"></xp:save>
                </xp:this.action>
</xp:eventHandler>
Any ideas?
Feb 23, 2011, 9:15 PM
149 Posts
Re: save data sources creating multiple documents
a long shot...
 
 if you have other "none rendered" custom controls on the page make sure they do not have data sources in them
All datasources will be saved when you save, even the onces not rendered (unless you set the scope of the data source to request)

Best Regards
Thomas Adrian
http://www.notessidan.se
 
 

Feb 24, 2011, 9:35 AM
13 Posts
Re: save data sources creating multiple documents
Hello,
 
In past while developing xpage to push document created to other db i used save data source which use to create two document in two data sources which i didn't require.So as a workaround I used two panels on an xpage with each panel >> data has only single source and have created save as button type>>button and in event selected save document in both the panel.So now with hide when i use to bring panel required and save document in desired repository.
 
For your case please try making use of save button and in button tab options select button type as "Button" instead of "Submit"  and in event try saving the datasources as document1.save();document2.save() on button click event. 
Feb 24, 2011, 9:22 AM
122 Posts
Re: save data sources creating multiple documents
If you only want to save one data source, the best method is probably to specificaly save that datasource. To do that, change the button type from Submit to Button. Then use SSJS to call the save method for your DominoDocument datasource. By default the first datasource will be document1, so it would be document1.save();
 
If you then want to go to a specific XPage after this function, you can add a simple action afterwards. If you always want to go to the same XPage after successful processing, you've got a property on the main pretty panel for the XPage itself to define the next XPage after success or failure (by default the same page). If that doesn't cover what you need, you can always use Navigation Rules. It's explained in Mastering XPages, I've blogged about it http://hermes.intec.co.uk/Intec/Blog.nsf/dx/10122009184850HERQ3K.htm, and so did Jeremy Hodge on The XPages Blog http://xpagesblog.com/xpages-blog/2010/8/9/using-navigation-rules-in-your-xpages-application.html 
Feb 24, 2011, 9:49 AM
13 Posts
Re: save data sources creating multiple documents
Hi Paul,yesterday i was trying to preview xpage in IE which I have developed ,the build is done in 8.5.1,I tried creating document in other db through client it worked when same xpage launched in IE and after filling  4-5 fields test data and attaching a document error i got in IE browser as exception occured calling method notesxspdocument.save() not allowed to access or modify the file.Later I changed event of my save button from save datasources to save document and this worked well both in client and web.But i am still trying to figure out this starnge behaviour.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal